

function loadArticlePage(iid) {
	Ext.Msg.alert("ID : + " + iid);
	var token = "home#article/loadPage/" + iid;
	addWindow('ArticleEdit', token, 'Article Edit', true);
}

// Create the store
var articleSearchResultsStore = Ext.create('Ext.data.Store', {
	id : 'articleSearchResultsStore',
	model : 'Article',
	autoDestroy : true,
	proxy : {
		type : 'ajax',
		batchActions : false,
		pageSize : 5,
		api : {
			read : 'articleSearch/searchAllArticles.json'
		},
		reader : {
			type : 'json',
			root : 'articles'
		}
	},
	autoLoad : true

});

Ext
		.define(
				'scribbles.ArticleSearchResults',
				{
					extend : 'Ext.grid.Panel',
					alias: 'widget.ArticleSearchResults',
					store : articleSearchResultsStore,
					padding : 5,
					title : 'Article',
					frame : false,
					forceFit : true,
					columns : [
							{
								header : 'ID',
								dataIndex : 'id'
							},
							{
								header : 'Name',
								dataIndex : 'name',
								renderer : function(value, meta, record) {
									return '<a href="javascript:loadArticlePage(3);">'+value+'</a>';
								}
							},{
								header : 'Description',
								dataIndex : 'description'
							}, {
								header : 'Article Content',
								dataIndex : 'articleContent'
							}, {
								header : 'Created By',
								dataIndex : 'createdBy'
							}, {
								header : 'Created Date',
								dataIndex : 'createdDate',
								xtype : 'datecolumn'
							} ]
				});